package com.hz.house.controller.activity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hz.house.common.ResultUtil;
import com.hz.house.service.activity.ZhongqiuActivityService;
import com.hz.house.token.CurrentUser;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 中秋活动接口
 * @author lfw
 */
@RestController
@RequestMapping("/api/v2/activ/zq")
@Api(value = "中秋活动接口列表")
public class ActivityController {

	@Autowired
	private ZhongqiuActivityService zqService;
	
	/**
	 *  加入活动
	 * @return
	 */
	@ApiOperation(value = "加入活动，无需传参")
	@GetMapping("/joinInact")
	public Object joinActivity() {
		return zqService.joinActivity();
	}
	
	@ApiOperation(value = "帮好友助力,friendid被助力好友的id")
	@GetMapping("/doHelp")
	public Object helpFriends(Integer hisId) {
		return this.zqService.helpFriends(hisId);
	}
	
	
	@ApiOperation(value = "用户进入自己的活动界面查询自己的信息，包括是否参与，助力人数，助力者名字")
	@GetMapping("/getMyUserInfo")
	public Object getMyInfo() {
		return this.zqService.getUserInfo();
	}
	
	@ApiOperation(value = "用户通过分享进来，进入助力者的页面，查询助力者的助力人数，"
			+ "助力者名字等,hisId 他的id，被助力者，就是分享带进来的id参数")
	@GetMapping("/getHisUserInfo")
	public Object getHisInfo(Integer hisId) {
		return this.zqService.getHisInfo(hisId);
	}
	
	
	/**
	 * 分页查询我的助力者信息，弹窗显示
	 * @return
	 */
	@ApiOperation(value = "用户点击助力者详情时分页查询助力者头像名称助力时间信息."
			+ "page页码，默认每页10条.如果助力者查询被助力者的信息，带上被助力者的id，hisId,否则默认查询自己的")
	@GetMapping("/getHelpers")
	public  Object searchHelpersPage(Integer page,Integer hisId) {
		return this.zqService.searchHelpersPage(page,hisId);
	}
	
	@ApiOperation(value = "获取我自己的ID")
	@GetMapping("/getMyId")
	public Object getMyId() {
		 return ResultUtil.ok(CurrentUser.getCurrentUserId());
	}
	
	@GetMapping("/test")
	public void test() {
		this.zqService.test();
	}
	
}
